<?php
class Activites_m extends CI_Model{
    function __construct(){
        parent::__construct();
        $this->load->database();
    }
    
    function list_content($table){
        return $this->db->get_where($table)->result_array();
      
    }
    
    function add_data($table, $data){
        return $this->db->insert($table, $data);
        
    }
    
    function get_details($table, $id){
        return $this->db->get_where($table, array('id'=>$id))->row();        
    }
    
    function update_data($table, $data, $id){
        $query = $this->db->update($table, $data, array('id'=>$id));
        if($this->db->affected_rows()>0){
            return 1;
        }else{
            return 0;
        }
    }
    
    function delete_data($table, $id){
        $query = $this->db->delete($table, array('id'=>$id));
        if($this->db->affected_rows()>0){
            return 1;
        }else{
            return 0;
        }
        
    }
    
}
?>
